package com.itheima.d09_lambda_constructor;

/**
 * 目标：了解Lambda表达式的构造方法引用的语法和使用场景
 */
public class Test {

    /**
     * 设计一个方法，让所有具有游泳功能选手参加
     *    参数：游泳接口
     */
    public static void swimGame(ISwimming player){
        Player player1 = player.createPlayer("小狗",2);
        player1.swim();
    }


    public static void main(String[] args) {
        //小狗：游泳
        /*swimGame(new ISwimming() {
            @Override
            public Player createPlayer(String name, int age) {
                return new Player(name, age);
            }
        });*/

        /*swimGame((String name, int age) -> {
                return new Player(name, age);
            }
        );*/

        /*swimGame(( name,  age) ->new Player(name, age));*/


        swimGame(Player::new);
    }
}
